package com.jetwinner.webfast.module.bigapp.service;

import com.jetwinner.webfast.kernel.AppUser;
import com.jetwinner.webfast.kernel.dao.support.OrderBy;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author xulixin
 */
public interface AppGroupService {

    int searchGroupsCount(Map<String, Object> conditions);

    List<Map<String, Object>> searchGroups(Map<String, Object> conditions, OrderBy orderBy,
                                           Integer start, Integer limit);

    int addGroup(AppUser user, Map<String, Object> group);

    Map<String, Object> getGroup(Integer id);

    boolean isOwner(Integer groupId, Integer userId);

    boolean isAdmin(Integer groupId, Integer userId);

    boolean isMember(Integer groupId, Integer userId);

    int searchMembersCount(Map<String, Object> conditions);

    List<Map<String, Object>> searchMembers(Map<String, Object> conditions, OrderBy orderBy, int start, int limit);

    Map<String, Object> getMemberByGroupIdAndUserId(Integer groupId, Integer userId);

    void changeGroupBackgroundLogo(Integer id, String filePath, Map<String, Object> options);

    void changeGroupLogo(Integer id, String filePath, Map<String, Object> options);

    Map<String, Map<String, Object>> getGroupsByIds(Set<Object> groupIds);

    void updateGroup(Integer id, Map<String, Object> fields);
}
